
local LrDialogs = import "LrDialogs"
local LrView = import "LrView"
local bind = LrView.bind

local prefs = import 'LrPrefs'.prefsForPlugin()

RhubarbExportDialogSections = {}

RhubarbExportDialogSections.sectionsForTopOfDialog = function( viewFactory, propertyTable )

	--propertyTable.galleryRoot = prefs.galleryRoot;
	--propertyTable.buttonEnabled = false -- button starts out disabled

	return 
	{ --section entries
	
		{ -- RHUBARB SETTINGS section 
		
			title = 'Rhubarb settings',
			
			-- bind the synopsis to a variable for a dynamic description
			-- of this section that appears when it is collapsed
			synopsis = bind { key = 'gallery_url', object = propertyTable },
			
			spacing = viewFactory:control_spacing(),
		
			-- GALLERY URL ROW
			viewFactory:row 
			{ 
				spacing = viewFactory:label_spacing(), 
				
				viewFactory:static_text
				{
					title = 'Gallery URL: ',
					width = LrView.share "label_width", -- the shared binding
					selectable = false,
					alignment = right,
				},
				
				-- GALLERY URL FIELD
				viewFactory:edit_field 
				{ 
					fill_horizontal = 1,
					width = 300,
					value = bind 'gallery_url', -- bound to property
					immediate = false, -- update value w/every keystroke
				},
			}, 
			-- AUTH TOKEN ROW
			viewFactory:row 
			{
				spacing = viewFactory:label_spacing(), -- default spacing
				
				viewFactory:static_text
				{
					title = 'Auth Token: ',
					width = LrView.share "label_width", -- the shared binding
					selectable = false,
					alignment = right,
				},			
			
				-- AUTH TOKEN FIELD
				viewFactory:password_field 
				{ 
					fill_horizontal = 1,
					width = 300,
					value = bind 'auth_token', -- bound to property
					immediate = false, -- update value w/every keystroke
				},			
			}, --end row
			
		}, --end RHUBARB SETTINGS section 
		
		{ -- ALBUM section 
			
			title = 'Export to album...',
			
			-- bind the synopsis to a variable for a dynamic description
			-- of this section that appears when it is collapsed
			synopsis = bind { key = 'album_name', object = propertyTable },
			
			spacing = viewFactory:control_spacing(),
		
			-- ALBUM NAME ROW
			viewFactory:row 
			{ 
				spacing = viewFactory:label_spacing(), 
				
				viewFactory:static_text
				{
					title = 'Album name: ',
					width = LrView.share "label_width", -- the shared binding
					selectable = false,
					alignment = right,
				},
				
				-- ALBUM NAME FIELD
				viewFactory:edit_field 
				{ 
					fill_horizontal = 1,
					width = 300,
					value = bind 'album_name', -- bound to property
					immediate = false, -- update value w/every keystroke
				},
			},
			-- ALBUM PASSWORD ROW
			viewFactory:row 
			{ 
				spacing = viewFactory:label_spacing(), 
				
				viewFactory:static_text
				{
					title = 'Album pass: ',
					width = LrView.share "label_width", -- the shared binding
					selectable = false,
					alignment = right,
				},
				
				-- ALBUM PASSWORD FIELD
				viewFactory:edit_field 
				{ 
					fill_horizontal = 1,
					width = 300,
					value = bind 'album_pass', -- bound to property
					immediate = false, -- update value w/every keystroke
				},
			},
			
		},
	}
end